package com.example.mybatisplus.web.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.mybatisplus.model.domain.Business;
import com.example.mybatisplus.model.dto.PageDTO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.example.mybatisplus.common.JsonResponse;
import com.example.mybatisplus.service.BusinessRecommendationsService;
import com.example.mybatisplus.model.domain.BusinessRecommendations;


/**
 *
 *  前端控制器
 *
 *
 * @author lxp
 * @since 2025-03-12
 * @version v1.0
 */
@RestController
@RequestMapping("/api/businessRecommendations")
public class BusinessRecommendationsController {

    @Autowired
    private BusinessRecommendationsService businessRecommendationsService;

    @GetMapping("pageList")
    public JsonResponse pageList(
            @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {

        // 创建 PageDTO 对象并设置分页参数
        PageDTO dto = new PageDTO();
        dto.setPageNo(pageNo);
        dto.setPageSize(pageSize);

        // 调用业务层方法
        Page<BusinessRecommendations> page = businessRecommendationsService.pageList(new BusinessRecommendations(), dto);

        // 返回响应
        return JsonResponse.success(page);
    }
}

